package otaku.gateway.core;

import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.HttpHeaders;

public class AddHeaderUpstreamRequestFilter implements UpstreamRequestFilter {
    private final HttpHeaders httpHeaders;

    public AddHeaderUpstreamRequestFilter(HttpHeaders httpHeaders) {
        this.httpHeaders = httpHeaders;
    }

    @Override
    public void filter(FullHttpRequest request) {
        for (var header : httpHeaders) {
            request.headers().add(header.getKey(), header.getValue());
        }
    }
}
